#include <iostream>
#include <string>
using namespace std;
string strlower(string a)
{
  for (int i = 0; i < a.size(); i++)
  {
    if (isupper(a[i]))
    {
      a[i] = tolower(a[i]);
    }
  }
  return a;
}
int main()
{
  string str1, str2, temp = "";
  int res = 0, start=-1;
  getline(cin, str1);
  getline(cin, str2);
  str1 = strlower(str1);
  str2 = strlower(str2);
  // start = str2.find(str1);
  // WRONG HERE
  int i = 0;
  for (; i < str2.size();)
  {
    while (str2[i]==' ' && i<str2.size()) i++;
    while (str2[i]!=' ' && i<str2.size()) {
      temp += str2[i];
      i++;
    }
    if (str1 == temp) {
      if(start==-1) start = i-str1.size();
      res++;
    }
    temp.clear();
  }
  if(start!=-1) cout << res << ' ' << start << '\n';
  else cout << "-1\n";

  return 0;
}

